
<!--<div id="form-top">-->
<div class="onecolumn">
    <div class="header">
        <span style="color: red; text-align: center; font-weight: bold;">Đăng ký bạn đọc mới</span>
    </div>
    <br class="clear"/>
    <div id="form-top">
        <?php
        $form = $this->form;
        $form->setAttribute('enctype', 'multipart/form-data');
        $form->setAttribute('action', $this->url('add-new-reader/default', array('action' => 'index',)));
        $form->prepare();
        echo $this->form()->openTag($form);
        echo $this->formHidden($form->get('roleID'));
        ?>
        <fieldset>
            <legend>Thông tin về bạn đọc</legend>                   
            <p>
                <?php
                echo $this->formLabel($form->get('cardBarcode'));
                echo $this->formInput($form->get('cardBarcode'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formLabel($form->get('fullName'));
                echo $this->formInput($form->get('fullName'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formRow($form->get('classID'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formLabel($form->get('password'));
                echo $this->formInput($form->get('password'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formLabel($form->get('sex'));
                echo $this->formSelect($form->get('sex'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formLabel($form->get('residentAddress'));
                echo $this->formInput($form->get('residentAddress'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formLabel($form->get('birthday'));
                echo $this->formRow($form->get('day'));
                ?>
                <span></span>
                <?php
                echo $this->formRow($form->get('month'));
                ?>
                <span></span>
                <?php
                echo $this->formRow($form->get('year'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formLabel($form->get('nativePlace'));
                echo $this->formInput($form->get('nativePlace'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formLabel($form->get('email'));
                echo $this->formInput($form->get('email'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formRow($form->get('yearLearn'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formLabel($form->get('phoneNumber'));
                echo $this->formInput($form->get('phoneNumber'));
                ?>
            </p>


            <p>
                <?php
                echo $this->formLabel($form->get('isActive'));
                echo $this->formSelect($form->get('isActive'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formRow($form->get('description'));
                ?>
            </p>
            <p>
                <?php
                echo $this->formRow($form->get('profilePhoto'));
                ?>
            </p>
            <div class="viewMessae" style="text-align: center">
                <?php
                if (isset($myMessage)) {
                    foreach ($myMessage as $key => $message) {
                        if ($message == "cardBarcode")
                            echo '<span style="color:red;font-weight:bold">Mã thẻ chỉ là một dãy các chữ số</span><br/>';
                        if ($message == "phoneNumber")
                            echo '<span style="color:red;font-weight:bold">Số điện thoại là một dãy số</span><br/>';
                        if ($message == "saveOK")
                            echo '<span style="color:red;font-weight:bold">Đăng ký bạn đọc thành công</span><br/>';
                        if ($message == "userExist")
                            echo '<span style="color:red;font-weight:bold">Mã bạn đọc này đã tồn tại</span><br/>';
                    }
                }
                ?>
            </div>

            <div id="button-return">
                <?php
                echo $this->formInput($form->get('register'));
                ?>
                <input type="reset" name="reset" value="Reset">
            </div>
        </fieldset>
        <?php echo $this->form()->closeTag($form); ?>
    </div>
</div>
<!-- Danh sách bạn đọc đăng ký làm thẻ-->
<div class="onecolumn">
    <div class="header">
        <span style="color: red; text-align: center; font-weight: bold;">Danh sách bạn đọc đăng ký làm thẻ</span>
    </div>
    <br class="clear"/>
    <div class="content">
        <form id="form_data" name="form_data" action="" method="post">
            <div id="">
                <p>
                    <label style="color: red;font-weight: bold;">Lựa chọn hiển thị: </label>
                    <select style="width: 150px;margin-bottom: 10px;">
                        <option value="sex">Toàn bộ</option>
                        <option value="male">Trong vòng 1 tháng</option>
                        <option value="female">Trong vòng 2 tuần</option>
                    </select>
                </p>
            </div>
            <table class="data" width="100%" cellpadding="0" cellspacing="0">
                <thead>
                    <tr>
                        <th style="width:10px">
                            <input type="checkbox" id="check_all" name="check_all"/>
                        </th>
                        <th style="width:10%">Mã mã thẻ</th>
                        <th style="width:18%">Họ tên</th>
                        <th style="width:13%">Đơn vị</th>
                        <th style="width:10%">Khóa học</th>
                        <th style="width:17%">Liên hệ</th>
                        <th style="width:10%">Ngày tạo</th>
                        <th style="width:12%">Tình trạng</th>
                        <th style="width:10%">Thao tác</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if (isset($paginator) && $paginator != null): ?>
                        <?php foreach ($paginator as $row): ?>
                            <tr>
                                <td>
                                    <input type="checkbox"/>
                                </td>
                                <td><?php echo $this->escapeHtml($row->cardBarcode); ?></td>
                                <td>
                                    <?php
                                    $cardBarcode = str_replace('.', '-', $row->cardBarcode);
                                    ?>
                                    <a href="<?php echo $this->url('list-reader/default', array('action' => 'detailReader', 'id' => $cardBarcode)) ?>">
                                        <?php echo $this->escapeHtml($row->fullName); ?>
                                    </a>
                                </td>
                                <td><?php echo $this->escapeHtml($row->className . ' - ' . $row->facultyName); ?></td>
                                <td><?php echo $this->escapeHtml($row->yearLearn); ?></td>
                                <td><?php echo $this->escapeHtml($row->residentAddress); ?></td>
                                <td>
                                    <?php
                                    $dateCreated = new DateTime($row->dateCreated);
                                    echo $this->escapeHtml($dateCreated->format('d/m/Y'));
                                    ?>
                                </td>
                                <td>
                                    <?php
                                    if ($row->isActive == 0)
                                        echo "Đăng ký mới";
                                    else if ($row->isActive == 1)
                                        echo "Lưu thông";
                                    else if ($row->isActive == 2)
                                        echo "Tạm khóa";
                                    ?>
                                </td>
                                <td>
                                    <a href="<?php echo $this->url('add-new-reader/default', array('action' => 'editReader', 'id' => $row->userID)) ?>" style="margin-left: 20px;"><img src=<?php echo $this->basePath() . '/img/icon_edit.png' ?> alt="edit" class="help" title="Chỉnh sửa"/></a>
                                    <a href="" style="margin-left: 20px;"><img src=<?php echo $this->basePath() . '/img/delete.png' ?> alt="Xóa" class="help" title="Xóa"/></a>
                                </td>
                            </tr>
                        <?php endforeach; ?>
                    <?php endif; ?>
                </tbody>
            </table>
            <?php
            // add at the end of the file after the table
            echo $this->paginationControl(
                    // the paginator object
                    $this->paginator,
                    // the scrolling style; see http://zf2.readthedocs.org/en/release-2.1.4/modules/zend.paginator.usage.html#rendering-pages-with-view-scripts
                    'sliding',
                    // the partial to use to render the control
                    array('partial/paginator.phtml', 'Admin'),
                    // the route to link to when a user clicks a control link
                    array(
                'route' => 'list-reader'
                    )
            );
            ?>
            <div id="chart_wrapper" class="chart_wrapper"></div>
            <!-- End bar chart table-->
        </form>
    </div>
</div>